/**
 * 
 */
package nl.boektrust.btsoep.shared.model;

/**
 * @author rao3
 *
 * codes are derived from ONIX 2.1 codelist 26
 */
public enum ContentSpecifierType {
	UNDEFINED,NURCODE,NUGICODE,GEOCODE;
	
	public static String stringValue(ContentSpecifierType t) {
		String value = new String();
		switch (t) {
		case UNDEFINED: value = "onbekend"; break;
		case NURCODE: value = "NUR"; break;
		case NUGICODE: value = "NUGI"; break;
		case GEOCODE: value = "BT Geocode"; break;
		}
		return value;
		
	}
	
	public static boolean isNumericValue(ContentSpecifierType t) {
		boolean value = false;

		switch (t) {
		case UNDEFINED: value = false; break;
		case NURCODE: value = true; break;
		case NUGICODE: value = true; break;
		case GEOCODE: value = false; break;
		}
		return value;

	}
	
	public static ContentSpecifierType parseStringIntoContentSpecifierType(String s) {
		if (s.equals("NUR")) return NURCODE;
		if (s.equals("NUGI")) return NUGICODE;
		if (s.equals("BT Geocode")) return GEOCODE;
		return UNDEFINED;
	}
	
	public static int intValue(ContentSpecifierType t) {
		int value = -1;
		switch (t) {
		case UNDEFINED: value = -1; break;
		case NURCODE: value = 32; break;
		case NUGICODE: value = 23; break;
		case GEOCODE: value = 23; break;
		
		}
		return value;
	}


}
